<template>
	<view class="">
		<button type="default" @click="upImg">点击上传图片</button>
		<image v-for="item in imgArr" :src="item" @click="preImg(item)"></image>
		<!-- #ifdef H5-->
		<view class="">只在h5中出现</view>
		<!-- #endif -->
		<!-- #ifdef MP-WEIXIN-->
		<view class="">只在微信小程序中出现</view>
		<!-- #endif -->
	</view>
</template>

<script>
	export default{
		data(){
			return{
				imgArr:[]
			}
		},
		methods:{
			upImg:function(){
				let that=this
				uni.chooseImage({
					count:5,
					success(res) {
						that.imgArr=res.tempFilePaths
						console.log(res)
					}
				})
			},
			preImg:function(current){
				uni.previewImage({
					current:current,
					urls:this.imgArr
				})
			}
		},
		onLoad() {
			// #ifdef H5
			console.log("我希望在h5中打印")
			// #endif
			// #ifdef MP-WEIXIN
			console.log("我希望在微信小程序中打印")
			// #endif
		}
	}
</script>

<style>
</style>
